<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of RejectStockout
 *
 * @author 志鹏
 */
class RejectStockout extends WorkflowAbstract {
    
    public function run() {
        
        if($_POST["memo"]) {
            $model = D("WorkflowProcess");
            $map = array(
                "node_id" => $_GET["node_id"],
                "mainrow_id" => $_GET["mainrow_id"]
            );
            $model->where($map)->save(array("memo" => $_POST["memo"]));
            $stockout = D("StockoutOrdersRelation");
            $stockout->relation(true)->where("source_id=".$this->mainrowId)->delete();
            return "";
        }
        
        import("@.Form.Form");
        $form = new Form("WorkflowMemo");
        $this->view->assign("FormHTML", $form->makeForm(""));
        $this->view->assign("lang_title", "leave_reject_reason");
        $this->view->display("../Common/Workflow/leaveMemo");
        
        return "wait";
    }
    
}

?>
